package com.example.smartcitymovie.dao;

import androidx.room.Dao;
import androidx.room.Insert;
import androidx.room.Query;

import com.example.smartcitymovie.entity.User;

@Dao
public interface Userdao {


    @Query("select * from user where user_name = :userName and password = :password")
    User selectUser(String userName, String password);


    @Query("select * from user where id = :userId")
    User userInfo(Integer userId);

    @Query("update user set nick_name = :nickName , phonenumber = :phoneNumber , id_card = :idCard , sex = :sex where id = :userId")
    int updateUserInfo(String nickName,String phoneNumber,String idCard,int sex,int userId);

    @Query("update user set password = :newPassword where password = :oldPassword and id = :userId")
    int resetPassword(String oldPassword,String newPassword,int userId);

    @Insert
    void insertAll(User... users);
}
